#include "NetElevatorBackDataCmd.h"

NetElevatorBackDataCmd::NetElevatorBackDataCmd(QObject *parent) :
    BaseCmd(parent)
{
    this->m_protocolType = ProtocolType::NetPointProtocol;
    this->m_functionCode = FunctionCode;

}

Package NetElevatorBackDataCmd::toPackage()
{
    Package package;
    QByteArray body;

   // body.append(DataTypeConver::intToByteArray(m_roomNumber,4));

    qDebug()<<"topackage backcmd";
    body.append(m_Elevatornum);
    package.setFunction(FunctionCode);
    package.setBody(body);
    return package;
}

void NetElevatorBackDataCmd::unPackage(Package package)
{
     qDebug()<<"unpackage backcmd";
    m_Elevatornum=package.body().mid(1,1).toHex().toInt(0,16);
    m_floor=package.body().mid(3,1).toHex().toInt(0,16);
    m_state=package.body().mid(4,1).toHex().toInt(0,16);
    qDebug()<<"m_Elevatornum="<<m_Elevatornum;
    qDebug()<<"m_floor="<<m_floor;
    qDebug()<<"m_state="<<m_state;
}

quint8 NetElevatorBackDataCmd::Elevatorfloor()
{
    return m_floor;
}
quint8 NetElevatorBackDataCmd::Elevatornum()
{
    return m_Elevatornum;
}
quint8 NetElevatorBackDataCmd::Elevatorstate()
{
    return m_state;
}
